package factory.simpleFactory;

/**
 * 工厂类角色
 * @author : wlz
 */
public class Driver {
    //工厂方法，返回类型为抽象产品角色
    public static factory.simpleFactory.Car driverCar(String s) throws Exception {
        //返回具体的产品角色给Client
        if (s.equalsIgnoreCase("Benz")) {
            return new factory.simpleFactory.Benz();
        } else if (s.equalsIgnoreCase("Bemz")) {
            return new factory.simpleFactory.Bmw();
        } else {
            throw new Exception();
        }
    }
}
